import {
    computed,
    watchEffect,
    ref
} from "vue";
import {
    useRoute
} from "vue-router";
//不在路由白名单表的状态上
export const useNotOnRouteWhiteListStatus = (whiteList = []) => {
    const route = useRoute();
    //设置一个条件 日志页面时候不会出现返回首页按钮 
    const status = computed(() => !whiteList.includes(route.name));
    return status
}

//设置路由id变动下面相关的页码数也变
export const useLinkedRouterParam = (type, isNum = true) => {
    const route = useRoute()
    const currentParam = ref("")
    watchEffect(() => {
        const param = route.params[type]
        currentParam.value = isNum ? Number(param) : param
    })
    return currentParam
}